#include "Couleur.hpp"

using namespace std;

int main( int argc, char* argv[] )
{
  Couleur rouge( 120, 0, 0 );
  Couleur vert( 0, 120, 0 );
  Couleur bleu( 0, 0, 120 );

  unsigned i;//, j, k;
  int coeffR, coeffV, coeffB;
  for ( i = 0; i < 8; i++ )
    {
      coeffR = ( i & 4 ) / 4;
      coeffV = ( i & 2 ) / 2;
      coeffB = ( i & 1 );

      cout << coeffR << " * (" << rouge << ") + "
  	   << coeffV << " * (" << vert << ") + "
  	   << coeffB << " * (" << bleu << ") = "
  	   << rouge * double( coeffR ) + vert * double( coeffV )+ bleu * double( coeffB )
  	   << endl;
    }

  for ( i = 0; i < 8; i++ )
    {
      coeffR = ( i & 4 ) / 4;
      coeffV = ( i & 2 ) / 2;
      coeffB = ( i & 1 );

      cout << "rouge éclairé par "
  	   << coeffV <<" vert + " << coeffB << " bleu + " << coeffR << " rouge :"
  	   << rouge.eclairee( rouge * double( coeffR ) + vert * double( coeffV ) + bleu * double( coeffB ) ) << endl;
      
      rouge = Couleur( 120, 0, 0 );

      cout << "vert éclairé par "
  	   << coeffV <<" vert + " << coeffB << " bleu + " << coeffR << " rouge :"
  	   << vert.eclairee( rouge * double( coeffR) + vert * double( coeffV ) + bleu * double( coeffB ) ) << endl;
      
      vert = Couleur( 0, 120, 0 );

      cout << "bleu éclairé par "
  	   << coeffV <<" vert + " << coeffB << " bleu + " << coeffR << " rouge :"
  	   << bleu.eclairee( rouge * double( coeffR) + vert * double( coeffV ) + bleu * double( coeffB ) ) << endl;
      
      bleu = Couleur( 0, 0, 120 );
    }

  Couleur blanc( 255, 255, 255 );

  Couleur ambiant( 50, 50, 200 );
  Couleur lumiere( 80, 40, 240 );

  blanc.eclairee( ambiant );
  blanc.eclairee( lumiere );

  cout << blanc << endl;

  return 0;
}
